<!-- 我的 -->
<template>
  <view class="mine">
    <view class="personal-data">
      <view class="title f26"> 个人资料 </view>
      <view>
        <van-cell-group>
          <van-field
            title-width="200"
            input-align="right"
            label="用户名"
            readonly
            :value="userInfos.username"
          ></van-field>
          <van-field
            title-width="200"
            input-align="right"
            label="E-mail"
            readonly
            :value="userInfos.email"
          ></van-field>
          <van-field
            title-width="200"
            input-align="right"
            :value="userInfos.nickname"
            label="姓名"
            readonly
          ></van-field>
        </van-cell-group>
      </view>
    </view>

    <view class="message">
      <view class="title f26"> 通知消息 </view>
      <view>
        <van-cell-group>
          <van-field
            title-width="200"
            input-align="right"
            v-model="messageList.examine"
            label="您有某某单据待审核"
          ></van-field>
          <van-field
            title-width="200"
            input-align="right"
            v-model="messageList.inventory"
            label="某某商品库存不足多少"
          ></van-field>
          <van-field
            title-width="200"
            input-align="right"
            v-model="messageList.receipt"
            label="您有某某单据待审核                                                           "
          ></van-field>
        </van-cell-group>
      </view>
    </view>

    <view class="quit-login mt40 flexc lh40" @click="outLogin"> 退出登录 </view>
  </view>
</template>
  
  <script>
export default {
  data() {
    return {
      messageList: {
        examine: "立即去审核",
        inventory: "立即采购",
        receipt: "立即去审核",
      },
      userInfos: {},
    };
  },

  // 监听页面加载，该钩子被调用时
  onLoad() {},
  methods: {
    async getuserinfo() {
      let res = await this.$ajax.getUserinfo();
      if (res.code == 1) {
        this.userInfos = res.data;
      } else {
        uni.showToast({
          title: res.msg,
          icon: "none",
        });
      }
    },
    /*退出登录*/
    async outLogin() {
      console.log("退出登录");
      let res = await this.$ajax.outLogout();
      if (res.code == 1) {
        uni.navigateTo({
          url: '../login/login',
        });
      }
    },
  },

  mounted() {
    console.log(this.userInfo, "userInfo---");
    this.getuserinfo();
  },

  // 监听页面显示，页面每次出现在屏幕上都触发
  onShow() {
    uni.setNavigationBarTitle({
      title: "我的 - 丰苗智慧后勤",
    });
  },

  // 监听用户下拉动作，一般用于下拉刷新
  onPullDownRefresh() {},

  // 监听页面初次渲染完成，此时组件已挂载完成
  onReady() {},
};
</script>
  
  <style lang="scss">
.mine {
  min-height: 100vh;
  height: 100%;
  background: rgba(244, 244, 244, 1);
  padding-bottom: 50rpx;
  .personal-data {
    .title {
      padding: 20rpx;
      color: rgba(119, 119, 119, 1);
      text-align: left;
      font-family: SourceHanSansSC-regular;
    }
  }
  //   通知消息
  .message {
    .title {
      padding: 20rpx;
      color: rgba(119, 119, 119, 1);
      text-align: left;
      font-family: SourceHanSansSC-regular;
    }
  }
  .quit-login {
    background: white;
    color: #bd3124;
  }
}
</style>